home *** CD-ROM | disk | FTP | other *** search
/ Draw Works New Millennium - Vector & Bitmap / DrawWorks New Millennium - Vector and Bitmap for RISC OS Workstations.iso / fonttools / fontedsa / notes / notes < prev    next >
Text File  |  1997-09-01  |  7KB  |  144 lines

  1. Operations on scaffold lines:
  2.  
  3. 1  Use another character's scaffold lines as the base for the character
  4. 2  Create new local scaffold line
  5. 3  Create new global scaffold line, which will appear in all current descendants
  6. 4  Override an existing line with a new (local) definition
  7.        - new definition can be thick, L-tangent, R-tangent
  8. 5  Take existing line and adjust its position
  9. 6  Associate a point/set of points with a scaffold line
  10. 7  Link one scaffold line to another
  11.  
  12. 1: Right-drag character into skeleton window.
  13.     The destination character inherits all scaffold lines from the source,
  14.     losing any of its own in the process.  This link is remembered, so that
  15.     the lines actually reside in the source character, and any alterations made
  16.     in either character will be reflected in the other.
  17.  
  18. 2: Menu: scaffold.local.h/u/d/v/l/r creates a new local line of the
  19.     appropriate type.  The line is displayed in light blue rather than dark
  20.     blue, to show that it originates in this character, rather than being
  21.     inherited from another.  No other character has the line in it initially,
  22.     but right-dragging the character onto another will cause the new line to be
  23.     inheritied along with all the others.
  24.  
  25. 3: Menu: scaffold.global.h/u/d/v/l/r creates a new global line of the
  26.     appropriate type.  The difference between this and the previous operation is
  27.     that the line is immediately inherited by any characters which depend on the
  28.     current character (and on any which depend on them, and so on).  The
  29.     operation is only possible if there is a free line index which is not used
  30.      in the current character or any of its descendants.
  31.  
  32. 4: Select line to be overridden, then Menu: scaffold.replace.h/u/d/v/l/r.
  33.    The existing line is replaced by the new one, and is used in any descendants of the character.
  34.  
  35. 5: Drag line.
  36.     All characters containing the line are redrawn, and any bitmaps which
  37.     depend on the characters are also updated.
  38.  
  39. 6: Select scaffold line, then click points to be altered.
  40.    Alternatively drag a rectangle around the points and release.
  41.  
  42. 7: Select scaffold line, then SHIFT-SELECT on the control point of another line.
  43.    The second line is linked to the first.  A 'linear' link can be set up by using CTRL-SELECT.
  44.  
  45.  
  46. Data Structures
  47. -------------
  48.  
  49.       In character definition, 1 byte to indicate index into list of scaffold entries:
  50.  
  51. Scaffold structure (just after font header):
  52.  
  53.       1 byte: link onto next scaffold entry (base scaffold for this set)
  54.       1 byte: 8 bits indicating which x-scaffold entries are held in the base set
  55.       1 byte: 8 bits indicating which y-scaffold entries are held in the base set
  56.       1 byte: 8 bits indicating which x-scaffold entries are being overridden
  57.       1 byte: 8 bits indicating which y-scaffold entries are being overridden
  58.       3 bytes: 2-bytes: bits 0..11 = signed coordinate (lower one if this is a thick scaffold line)
  59.                               bits 12..14 = scaffold link index (0 if none)
  60.                               bit 15 = 'linear' link bit
  61.                   1-byte unsigned thickness (if this is a thick line)
  62.                             254 ==> this is an L-tangent line
  63.                             255 ==> this is an R-tangent line
  64.  
  65. The number of 3-byte entries following the initial 5-byte header depends on
  66. how may bits are set in bytes 3 and 4.  Lines without a bit set in bytes 1,2
  67. or 3,4 are deleted.
  68.  
  69. With up to 16 local lines per char, max data size = (16*3+5)*192 = 10176 bytes!
  70.  
  71.                 
  72. Problem:
  73.  
  74. For a given character, work out where each of x[0..7] and y[0..7] scaffold lines are.
  75.  
  76. Solution:
  77.  
  78.        Use bit arrays xb[0..7] and yb[0..7] initially all clear
  79.        Set x[] and y[] for the local lines, setting the appropriate bits
  80.        If not all bits are set, look up the definition for the 'base' character
  81.        For all local lines in that, if the bit is clear, set the x[] or y[] line and set the bit
  82.        Continue by taking that char's base char until all bits are set.
  83.  
  84. So we need to be able to look up the set for a char relatively quickly 
  85.  
  86. In the editor
  87. -----------
  88.  
  89. For each character, x/ychar[0..7] = code of character containing the local definition of the line
  90. For the local lines, x/ycoord[0..7] = position of line
  91.                            x/ywidth[0..7] = width of line  - only if x/ychar[] = this char code
  92.  
  93. Thus when a line is dragged, all other characters containing that line can be updated too.
  94.     (1) work out which char holds the local definition
  95.     (2) update any displayed chars with that line also held in the same base char.
  96.  
  97. The actual coordinate and width of the line are only stored in one place,
  98. since all others have a char code reference instead.
  99.  
  100. When a char's definition is altered (or added to), any other chars which
  101. depend on that character also receive the results of the change.  To avoid
  102. unpleasant surprises any deleted/undefined lines in the character are deemed
  103. to be deleted (local) lines in the new char, so if new lines are created in
  104. the old char, they do not suddenly appear in the new char.
  105.  
  106. Note that when a char's scaffold set is dragged into another char, the
  107. latter's local scaffold lines are lost (since the line index numbers cannot
  108. be readily predicted).  Also, any new lines added to the definition of the
  109. base char will not be seen in the new char (although alterations made to the
  110. existing set will affect both characters).
  111.  
  112. Updates
  113. -------
  114.  
  115. Copying a char's set into another:
  116.  
  117. x/ychar[] copied from the base char - except for deleted lines, where x/ychar[] = new char
  118. x/ycoord[] copied - &8000 ==> deleted
  119. x/ywidth[] copied - 254, 255 are special
  120.  
  121. Creating a new scaffold line:
  122.  
  123. If a line is selected, that is replaced by the new line
  124. If no line selected, a free index is seached for (ie. one whose line is currently deleted.
  125.      If no more free lines are available, error message tells you to select a line you don't need.
  126. The new line is always local to the character.
  127.  
  128. Dragging a scaffold line:
  129.  
  130. New lines can ONLY affect the character to which they belong - if the line
  131. did not previously exist, then any chars using that as a base will have a
  132. LOCAL deleted line instead.
  133.  
  134. So when dragging a line one must search for chars in the font which have a
  135. reference to the line, and update them - those which are displayed will be
  136. updated immediately, while the others are done when the line is dropped.
  137.  
  138. Loading/saving the font file
  139.  
  140. The scaffold lines are packed and unpacked as required - after the first
  141. unpacking (when the file is first loaded) the unpacked form is treated as
  142. the master definition, but the packed form is left lying around in the file
  143. for convenience when saving.
  144.